<?php
	class Reponse{
		
		private $id; // l'id de la réponse
		private $correcte; // 1 si correcte sinon 0
		private $idRefQuestion; // l'id de la question à laquelle la rep appartient
		private $contenu; // contenu de la question
		private $image; // image de la question si elle existe
		private $ordre; // l'ordre de la réponse dans la question
	

		public function __construct(){
			if(func_num_args() == 1)
			$this->hydrate(func_get_arg(0));
		}
		
		public function hydrate(array $donnees){
			foreach ($donnees as $key => $value){
				$method = 'set'.ucfirst($key);
				if (method_exists($this, $method)){
					$this->$method($value);
				}
			}
		}
		
		//GETTERS
		public function id(){return $this->id;}
		public function correcte(){return $this->correcte;}
		public function idRefQuestion(){return $this->idRefQuestion;}		
		public function contenu(){return $this->contenu;}
		public function image(){return $this->image;}
		public function ordre(){return $this->ordre;}

		//SETTERS
		public function setId($newReponse){$this->id = $newReponse;}
		public function setCorrecte($newCorrecte){$this->correcte = $newCorrecte;}
		public function setIdRefQuestion($newIdRedQuestion){$this->idRefQuestion = $newIdRedQuestion;}
		public function setContenu($newContenu){$this->contenu = $newContenu;}
		public function setImage($newImage){$this->image = $newImage;}
		public function setOrdre($newOrdre){$this->ordre = $newOrdre;}			
	}
?>